package com.hzp.controller;

import com.hzp.entity.Dept;
import com.hzp.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService deptService;

    @GetMapping("/list")
    public List<Dept> listDept(){
        return deptService.listDept();
    }

    @GetMapping("/get/{id}")
    public Dept getDept(@PathVariable("id") Integer id){
        return deptService.getDept(id);
    }

    @PostMapping("/add")
    public boolean addDept(@RequestBody Dept dept){
        return deptService.addDept(dept);
    }
}
